Improve test coverage: Add fix-permissions script and pip index-url v…#97
Conversation
📝 WalkthroughWalkthroughAdds a new ContainerRunner helper to check file executability and introduces tests that verify the fix-permissions script is executable and that pip's global.index-url is configured. Duplicate test function declarations were also introduced in the same test file. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/test_common.py (1)
96-103: Includeresult.stderrin the failure message for easier debugging.When
pip config get global.index-urlexits non-zero it writes the reason to stderr, but the current assertion message is static. Including it surfaces the actual pip error without changing test semantics.🔧 Proposed improvement
- assert result.returncode == 0, ( - "pip global.index-url is not set — expected an index-url in /etc/pip.conf" - ) + assert result.returncode == 0, ( + f"pip global.index-url is not set — expected an index-url in /etc/pip.conf\n" + f"pip stderr: {result.stderr.strip()}" + )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/test_common.py` around lines 96 - 103, The assertion in test_pip_index_url_configured does not include result.stderr when container.run("pip config get global.index-url") fails, making failures hard to diagnose; update the first assert for result.returncode == 0 in the test_pip_index_url_configured function to append or interpolate result.stderr (and optionally result.stdout) into the failure message so the pip error output from container.run is visible when the test fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/test_common.py`:
- Around line 96-103: The assertion in test_pip_index_url_configured does not
include result.stderr when container.run("pip config get global.index-url")
fails, making failures hard to diagnose; update the first assert for
result.returncode == 0 in the test_pip_index_url_configured function to append
or interpolate result.stderr (and optionally result.stdout) into the failure
message so the pip error output from container.run is visible when the test
fails.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (2)
tests/conftest.pytests/test_common.py
…alidation tests opendatahub-io#88 - Add file_executable() helper to ContainerRunner - Add test_fix_permissions_executable to verify /usr/local/bin/fix-permissions is present and executable in both Python and CUDA images - Add test_pip_index_url_configured to assert pip global.index-url is actually set (not just that [global] exists) Closes opendatahub-io#88 Signed-off-by: Shanmukh Pawan <smoparth@redhat.com>
9204637 to
197d28d
Compare
shifa-khan
left a comment
There was a problem hiding this comment.
LGTM. Just a suggestion, should we consider adding similar tests for uv?
Add fix-permissions script and pip index-url validation tests
Closes #88
Description
How Has This Been Tested?
Merge criteria:
Summary by CodeRabbit